home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 14642 / 14642.xpi / chrome / modules / trackers / bookmark.js next >
Text File  |  2009-10-19  |  2KB  |  50 lines

  1. /* Copyright 2009, Boomtango.com.  All Rights Reserved. */
  2. /* contact.js
  3.  * Responsible for tracking hContacts on pages
  4.  */
  5.  
  6. var EXPORTED_SYMBOLS = ["bookmark"];
  7. var bookmark = {
  8.     name: "Bookmark", 
  9.     name_plural: "Bookmarks", 
  10.     color: "#5F2018",
  11.     isInternal: true,
  12.  
  13.     onLoadTracks: function(url, doc){
  14.         var result = [];
  15.         var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].
  16.             getService(Components.interfaces.nsINavBookmarksService);
  17.         var ios = Components.classes["@mozilla.org/network/io-service;1"].
  18.             getService(Components.interfaces.nsIIOService);
  19.         var uri = ios.newURI(url, null, null);
  20.         this.url = url;
  21.         this.isbookmarked = bmsvc.isBookmarked(uri);
  22.         if(this.isbookmarked){
  23.             result.push(
  24.                 {
  25.                     type: "bookmark"
  26.                 }
  27.             );
  28.         }
  29.         return result;
  30.     },
  31.     onUnloadTracks: function(url, doc){
  32.         var result = [];
  33.         if(!this.isbookmarked && this.url == url){
  34.             var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].
  35.                 getService(Components.interfaces.nsINavBookmarksService);
  36.             var ios = Components.classes["@mozilla.org/network/io-service;1"].
  37.                 getService(Components.interfaces.nsIIOService);
  38.             var uri = ios.newURI(url, null, null);
  39.             if(bmsvc.isBookmarked(uri)){
  40.                 result.push(
  41.                     {
  42.                         type: "bookmark"
  43.                     }
  44.                 );
  45.             }
  46.         }
  47.         return result;
  48.     }
  49. };
  50.